* FILE NAME : PREG10.PRG
*
*
set colo to bg+/b,w+/n
SELE 1
GO TOP
STORE 0 TO CNT,CR,CNT1,CR1,CNT2,CR2,CNT3,CR3,REC
SELE 1
SET EXCLU OFF
USE &DR&F1 INDE &DR&F11
GO TOP
if Pname<>space(16)
** Buu Change to 8 characters for seaching Name - 13/9/04
   SEEK SUBS(PNAME,1,LEN(PNAME))
   do while SUBS(PAT_NAME,1,LEN(PNAME))=SUBS(PNAME,1,LEN(PNAME)) .AND. .not. eof()
      cnt=cnt+1
      skip
   enddo
   declare norec[cnt]
   declare fild[cnt]
   IF CNT<>0
      GO TOP
      SEEK SUBS(PNAME,1,LEN(PNAME))
      do while SUBS(PAT_NAME,1,LEN(PNAME))=SUBS(PNAME,1,LEN(PNAME)) .AND. .not. eof()
         cr=cr+1
         norec[cr]=recno()
         fild[cr]=pat_name+' '+pat_f_name+'     '+pat_sex+'   '+dtoc(pat_dob)+SPACE(4)+chr(186)+SPACE(4)+pat_filcod
         skip
      enddo
      @ 10,1 CLEA TO 23,78
      DO BOXT WITH 10,3," PATIENT'S NAME  FIRST NAME"+SPACE(7)+'SEX       D.O.B.'+SPACE(6)+"PATIENT'S FILE",'W+','RB',.F.,.T.
      SET COLO TO BG+/RB,GR+/R
      @ 13,3 CLEA TO 23,76
      @ 13,3 TO 23,76
      inkey()
      cari=achoice(14,5,22,74,fild)
      IF lastkey()=13
*         OKK=.T.
         REC=norec[cari]
         SELE 1
         SET INDEX TO
         goto REC
         @ 10,1 CLEA TO 23,78
         RETURN
      ENDIF
   ENDIF
ENDIF
SET COLOR TO BG+/B
@ 10,1 CLEA TO 23,78
DO BOXF WITH 11,24,"Processing, Please wait ...",'GR+','R','gr+*',.T.,.T.
SET COLOR TO W+/B, W+/N
SELE 1
SET EXCLU OFF
USE &DR&F1 INDE &DR&F11
GO TOP
IF PFNAME<>SPACE(16)
   SEEK SUBS(PFNAME,1,LEN(PNAME))
   do while SUBS(PAT_NAME,1,LEN(PNAME))=SUBS(PFNAME,1,LEN(PNAME)) .AND. .not. eof()
      cnt1=cnt1+1
      skip
   enddo
   declare norec[Cnt1]
   declare fild[Cnt1]
   IF CNT1<>0
      SELE 1
      USE &DR&F1 INDE &DR&F11
      SEEK SUBS(PFNAME,1,LEN(PNAME))
      do while SUBS(PAT_NAME,1,LEN(PNAME))=SUBS(PFNAME,1,LEN(PNAME)) .AND. .not. eof()
         cr1=cr1+1
         norec[cr1]=recno()
         fild[cr1]=pat_name+' '+pat_f_name+'     '+pat_sex+'   '+dtoc(pat_dob)+SPACE(4)+chr(186)+SPACE(4)+pat_filcod
         skip
      enddo
      @ 10,1 CLEA TO 23,78
      DO BOXT WITH 10,3," PATIENT'S NAME  FIRST NAME"+SPACE(7)+'SEX       D.O.B.'+SPACE(6)+"PATIENT'S FILE",'W+','RB',.F.,.T.
      SET COLO TO BG+/RB,GR+/R
      @ 13,3 CLEA TO 23,76
      @ 13,3 TO 23,76
      INKEY()
      cari=achoice(14,5,22,74,fild)
      IF LASTKEY()=13
*         OKK=.T.
         REC=norec[cari]
         SELE 1
         SET INDEX TO
         goto REC
         @ 10,1 CLEA TO 23,78
         return
      ENDIF
   ENDIF
   SET COLOR TO BG+/B
   @ 10,1 CLEA TO 23,78
   DO BOXF WITH 11,24,"Processing, Please wait ...",'GR+','R','gr+*',.T.,.T.
   SET COLOR TO W+/B, W+/N
   SELE 1
   SET EXCLU OFF
   USE &DR&F1 INDE &DR&F12
   SEEK SUBS(PFNAME,1,LEN(PNAME))
   do while SUBS(PAT_F_NAME,1,LEN(PNAME))=SUBS(PFNAME,1,LEN(PNAME)) .AND. .not. eof()
      CNT2=CNT2+1
      skip
   enddo
   declare norec[cnt2]
   declare fild[cnt2]
   IF CNT2>0
      SELE 1
      USE &DR&F1 INDE &DR&F12
      SEEK SUBS(PFNAME,1,LEN(PNAME))
      do while SUBS(PAT_F_NAME,1,LEN(PNAME))=SUBS(PFNAME,1,LEN(PNAME)) .AND. .not. eof()
         CR2=CR2+1
         norec[CR2]=recno()
         fild[CR2]=pat_f_name+' '+pat_name+'     '+pat_sex+'   '+dtoc(pat_dob)+SPACE(4)+chr(186)+SPACE(4)+pat_filcod
         skip
      enddo
      @ 10,1 CLEA TO 23,78
      DO BOXT WITH 10,3," FIRST NAME  PATIENT'S NAME"+SPACE(7)+'SEX       D.O.B.'+SPACE(6)+"PATIENT'S FILE",'W+','RB',.F.,.T.
      SET COLO TO W+/RB,GR+/R
      @ 13,3 CLEA TO 23,76
      @ 13,3 TO 23,76
      inkey()
      cari=achoice(14,5,22,74,fild)
      IF LASTKEY()=13
*         OKK=.T.
         REC=norec[cari]
         SELE 1
         SET INDEX TO
         goto REC
         @ 10,1 CLEA TO 23,78
         return
      ENDIF
   ENDIF
ENDIF
SET COLOR TO BG+/B
@ 10,1 CLEA TO 23,78
DO BOXF WITH 11,24,"Processing, Please wait ...",'GR+','R','gr+*',.T.,.T.
SET COLOR TO BG+/B, W+/N
SELE 1
SET EXCLU OFF
USE &DR&F1 INDE &DR&F12
IF PNAME<>SPACE(16)
   SEEK SUBS(PNAME,1,LEN(PNAME))
   do while SUBS(PAT_F_NAME,1,LEN(PNAME))=SUBS(PNAME,1,LEN(PNAME)) .AND. .not. eof()
      cnt3=cnt3+1
      skip
   enddo
   declare norec[Cnt3]
   declare fild[Cnt3]
   IF CNT3>0
      SELE 1
      USE &DR&F1 INDE &DR&F12
      SEEK SUBS(PNAME,1,LEN(PNAME))
      do while SUBS(PAT_F_NAME,1,LEN(PNAME))=SUBS(PNAME,1,LEN(PNAME)) .AND. .not. eof()
         CR3=CR3+1
         norec[CR3]=recno()
         fild[CR3]=pat_f_name+' '+pat_name+'     '+pat_sex+'   '+dtoc(pat_dob)+SPACE(4)+chr(186)+SPACE(4)+pat_filcod
         skip
      enddo
      @ 10,1 CLEA TO 23,78
      DO BOXT WITH 10,3," FIRST NAME  PATIENT'S NAME"+SPACE(7)+'SEX       D.O.B.'+SPACE(6)+"PATIENT'S FILE",'W+','RB',.F.,.T.
      SET COLO TO W+/RB,GR+/R
      @ 13,3 CLEA TO 23,76
      @ 13,3 TO 23,76
      inkey()
      cari=achoice(14,5,22,74,fild)
      IF LASTKEY()=13
*         OKK=.T.
         REC=norec[cari]
         SELE 1
         SET INDEX TO
         goto REC
         @ 10,1 CLEA TO 23,78
         return
      ENDIF
   ENDIF
ENDIF
RETURN
